/**
 * js下props的验证，需要额外安装 prop-types 库，然后设置组件的 propTypes 属性
 */

import React from "react";

// 引入 prop-types
import Types from "prop-types";

console.log("Types", Types);

class Hello extends React.Component {
  static propTypes = {
    name: Types.string,
    age: Types.number,
  };

  render() {
    return <p>Hello</p>;
  }
}

// Hello.propTypes = {
//   name: Types.string,
//   age: Types.number,
// };

class App extends React.Component {
  render() {
    return (
      <div>
        <h1>App</h1>

        <Hello name="张三" age={18} />
      </div>
    );
  }
}

export default App;
